acceptor_id=0;

all_folder="all/"
cpu_folder="cpu/"
lat_folder="lat/"

delimeter="/"
txt_postfix=".txt"
pidstat="pidstat"$txt_postfix;
top="top"$txt_postfix;

ip1=$1;
ip2=`expr $1 + $2 `;
config_file=$3;
general_path=$4;
interval=$5;
num_packets_per_interval=$6
folder_id=$7;
 


for((i=ip1; i<ip2; i++))
do
    echo $i 
             pidstat_path=$general_path$folder_id$delimeter$cpu_folder$acceptor_id$pidstat;
                 top_path=$general_path$folder_id$delimeter$cpu_folder$acceptor_id$top;
    performance_file_path=$general_path$folder_id$delimeter$all_folder$acceptor_id$txt_postfix;
        latency_file_path=$general_path$folder_id$delimeter$lat_folder$acceptor_id$txt_postfix;
         
    echo $performance_file_path;
    
    ssh -f -n "node"${i} "pidstat 1 |grep acceptor >> $pidstat_path";
    ssh -f -n "node"${i} "top -b -d 1 | grep acceptor >> $top_path";
	ssh -f -n "node"${i} "/home/parisa/RING-PAXOS-JOURNAL/svn/RP-original/acceptor/acceptor $acceptor_id $config_file $num_packets_per_interval $interval $performance_file_path $latency_file_path";
	
    ((acceptor_id+=1));
done

